#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive

${HIVE_HOME} -S -e "
create database if not exists edu_dwb;
use edu_dwb;

DROP TABLE if EXISTS edu_dwb.dwb_customer_wide;
CREATE TABLE edu_dwb.dwb_customer_wide(
--来自customer_relationship的数据
id                      int,--意向id
create_date_time        string,--意向创建时间
deleted                 string,--判断意向字段
customer_id             int,--用户id
orgin_type              string,--数据来源:线上or线下
itcast_clazz_id         int,--班级id
itcast_school_id        int,--校区id
itcast_subject_id       int,--学科id
origin_channel          string,--来源渠道
creator                 int,--负责意向销售id(咨询老师id)
payment_state           string,--支付状态
payment_time            string,--支付时间
--来自customer_clue表的字段
clue_id                 int,--线索id
--来自customer_appeal表的字段
appeal_status           int,--申诉状态 0:待审核1:无效2:有效
--来自itcast_clazz的id
itcast_school_name      string,--校区名称
itcast_subject_name     string,--学科名称
--来自employee表的字段
tdepart_id              int,--销售部门id
--来自scrm_department表
name                    string--部门名称

)comment '报名详细宽表'
row format delimited fields terminated by '\t'
stored as orc
tblproperties ('orc.compress' = 'SNAPPY');
"